package com.ssy.lingxi.search.repository;

import com.ssy.lingxi.search.entity.channel.PurchaseChannel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
 * 进货单持久化层
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/9/4
 */
public interface PurchaseChannelRepository extends JpaRepository<PurchaseChannel,Long>, JpaSpecificationExecutor<PurchaseChannel> {
    List<PurchaseChannel> findByMemberIdAndMemberRoleIdAndShopIdAndChannelMemberIdAndChannelMemberRoleId(Long memberId, Long memberRoleId, Long shopId, Long channelMemberId, Long channelMemberRoleId);

    List<PurchaseChannel> findByIdIn(List<Long> idList);

    PurchaseChannel findFirstByMemberIdAndMemberRoleIdAndCommodityUnitPriceIdAndShopIdAndChannelMemberIdAndChannelMemberRoleId(Long memberId, Long memberRoleId, Long commodityUnitPriceAndPicId, Long shopId, Long channelMemberId, Long channelMemberRoleId);

    Integer countByMemberIdAndMemberRoleIdAndShopIdAndChannelMemberIdAndChannelMemberRoleId(Long memberId, Long memberRoleId, Long shopId, Long channelMemberId, Long channelMemberRoleId);
}
